<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <head th:replace="common/head"/>
</head>
<body>
<div class="x-body">
    <form class="layui-form" style="padding-bottom: 10px;text-align: left;">
        客户：
        <div class="layui-inline">
            <select name="userId" lay-search="">
                <option value="">直接选择或搜索选择</option>
                <th:block th:each="map: ${userList}">
                    <option th:value="${map.userId}" th:text="${map.userName}"></option>
                </th:block>
            </select>
        </div>
        债务类型：
        <div class="layui-inline">
            <select name="debtType" lay-search="">
                <option value="">直接选择或搜索选择</option>
                <th:block th:each="map: ${debtType}">
                    <option th:value="${map.key}" th:text="${map.value}"></option>
                </th:block>
            </select>
        </div>
        立据时间起：
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" name="beginDate" lay-verify="myCheckDate" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input layDate">
            </div>
        </div>
        止：
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" name="endDate" lay-verify="myCheckDate" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input layDate">
            </div>
        </div>
        <button class="layui-btn" lay-submit lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
    </form>

    <xblock>
        <button class="layui-btn layui-btn-normal dialog" data-url="/debt/toAdd" data-title="添加">
            <i class="layui-icon">&#xe608;</i>添加
        </button>
    </xblock>

    <input type="hidden" id="editText" value="debt/editText">
    <input type="hidden" id="myEntityId" value="debtId">

    <table class="layui-table"
           lay-data="{url:'/debt/list', page:true,id:'table',limit:15,limits:[10,15,20,50,100]}"
           lay-filter="table">
        <thead>
        <tr>
            <!--<th lay-data="{field:'demo',align:'center', sort: true, edit:'text',templet:'#templetId'}">demo</th>-->
            <!--<th lay-data="{checkbox:true, fixed: true}"></th>-->

            <th lay-data="{field:'debtId',align:'center', sort: true}">debtId</th>
            <th lay-data="{field:'userId',align:'center', sort: true, templet:'#userList'}">客户</th>
            <th lay-data="{field:'debtType',align:'center', sort: true,templet:'#debtType'}">债务类型</th>
            <th lay-data="{field:'debtMoney',align:'center', sort: true}">金额</th>
            <th lay-data="{field:'realDebtMoney',align:'center', sort: true}">实际记账金额</th>
            <th lay-data="{field:'billTime',align:'center', sort: true}">立据时间</th>
            <th lay-data="{field:'remark',align:'center',edit:'text'}">remark</th>
            <th lay-data="{fixed:'right', align:'center',width:200, toolbar: '#row-bar'}">操作</th>
        </tr>
        </thead>
    </table>

    <script type="text/html" id="userList" th:inline="javascript">
        {{#  var list = [[${userList}]] }}
        {{#  for(var index in list){ }}
        {{#     if(d.userId == list[index].userId){ }}
        {{         unescape(list[index].userName.replace(/\\u/g, '%u')) }}
        {{#     } }}
        {{#  } }}
    </script>

    <script type="text/html" id="debtType" th:inline="javascript">
        {{#  var map = [[${debtType}]] }}
        {{#  for(var key in map){ }}
        {{#     if(d.debtType == key){ }}
        {{         unescape(map[key].replace(/\\u/g, '%u')) }}
        {{#     } }}
        {{#  } }}
    </script>

    <script type="text/html" id="row-bar">
        <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="edit" data-url="/debt/toEdit" data-title="编辑"
         data-id="debtId" data-width="800" data-height="600"><i class="layui-icon">&#xe642;</i> 编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" data-url="/debt/delete"><i
                class="layui-icon">&#xe640;</i> 删除</a>
    </script>
</div>
<div th:replace="common/js"></div>
<div th:replace="common/setting"></div>
<script type="text/javascript">
    layui.use('xtable');
</script>
</body>
</html>
